﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microhard.NotificationTypes.Validator;
using Microhard.Core.DBUtility;


namespace Microhard.NotificationTypes.Models
{
    public enum NotificiationType
    {
        Internal = 1,
        SMS = 2,
        Mail = 3
    }

    [FluentValidation.Attributes.Validator(typeof(ChatValidator))]
    public class NotificationModel : BasePermissionModel
    {
        [ModelPKIDAttribute]
        public Guid ChatID { set; get; }
        public User Sender { set; get; }
        public List<User> ReceiverToAdd { set; get; }
        public User Receiver { set; get; }
        public NotificiationType Type { set; get; }
        public DateTime SendingTime { set; get; }
        public DateTime ReceivingTime { set; get; }
        public NotificationContent Content { set; get; }
        public int Status { set; get; }
        public bool IsSysSender { set; get; }
        public string Status_DisplayTxt
        {
            get
            {
                string rtn = string.Empty;
                var status = (ChatStatus)Enum.Parse(typeof(ChatStatus), this.Status.ToString());
                switch (status)
                {
                    case ChatStatus.Sended: rtn = "已发送"; break;
                    case ChatStatus.Notified: rtn = "未阅读"; break;
                    case ChatStatus.Readed: rtn = "已阅读"; break;
                }
                return rtn;
            }
        }

    }
}
